<template>
    
    <div id = "wrap">
  <div id="login_container">
      <h3 class="title"> 造作后台管理系统</h3>
      <p class="admin">账号: admin &nbsp;&nbsp;密码:admin</p>
      <el-form :model="ruleForm" status-icon ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="用户名">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input type="password" v-model="ruleForm.pass"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="success" @click="submitForm('ruleForm')" style="width:100px">登录</el-button>
      </el-form-item>
    </el-form>
  </div>
</div>
</template>

<script>
import * as api from "@/api/getProlist";
export default {
  data() {
    return {
      form: {
        name: ""
      },
      ruleForm: {
        pass: ""
      }
    };
  },
  methods: {
    submitForm(formName) {
      this.uname = this.form.name;
      this.upwd = this.ruleForm.pass;
      console.log(this.uname, this.upwd)
      api.login({ userName: this.uname, upwd: this.upwd }).then(data => {
        console.log(data);
        if(data.data.code=="200"){
          alert("登陆成功");
          // localStorage.setItem("token",data.data.token)
          this.$router.push("/index")
        }else{
          alert("帐号密码错误或没有权限")
        }
      });
    }
  }
};
</script>

<style scoped="scoped">
* {
  list-style: none;
  text-decoration: none;
  color: cornsilk;
}
html,body{
  height: 100%;
}
body{
  margin: 0;
  padding: 0;
  overflow: hidden;
}
#wrap{
  width: 100vw;height: 100vh;
  background:url('https://img.zaozuo.com/fa6e614909e7e5e169fb00443898461c?x-oss-process=image/format,jpg/interlace,1')  no-repeat ;
  background-size: cover;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
}
#login_container {
  border-radius: 5px;
  background-clip: padding-box;
  margin: 180px 0 180px 100px;
  width: 350px;
  padding: 35px 35px 15px 35px;
  background:rgba(0, 0, 0, .1);
  border: 1px solid #eaeaea;
  box-shadow: 0 0 25px #cac6c6;
  border-radius: 30px
}
.title {
  margin: 0px auto 40px auto;
  text-align: center;
  color: cornsilk;
}
.rem{
    margin: 0px 0px 35px 0px;
}
.login{
    width: 100%
}
.el-button{
  background: rgba(0, 0, 0, .4);
  height: 40px;
  border: 0;
}
/deep/.el-form-item__label{
  color: cornsilk;
}
.admin{
  text-align: center;
}
</style>